/*
 * @Description: 
 * @Author: 葛玉根
 * @Date: 2021-02-25 16:40:33
 * @LastEditTime: 2021-02-25 19:56:43
 * @LastEditors: 葛玉根
 */
import { getAllDataType, getAllClickDataType, getAllClickDataItemType} from '../types/imgType'

export interface stateType{
    getAllData:getAllDataType[]
    getAllClickData: getAllClickDataType,
    getSwData: getAllClickDataItemType[],
    allImgFlag: boolean,
    swFlag:boolean
}
let initState: stateType = {
    getAllData: [],
    getAllClickData: {},
    getSwData:[],
    allImgFlag: false,
    swFlag: false
}
export default (state = initState, action: any) => {
    switch (action.type) {
        case "GETALLDATA":
            let getAllData = state.getAllData
            getAllData= action.data
            return { ...state, getAllData };
        case "GETALLCLICKDATA":
            let getAllClickData = state.getAllClickData
            getAllClickData = action.data
            return { ...state, getAllClickData };
        case "ALLIMGFLAG":
            let allImgFlag = state.allImgFlag
            allImgFlag = action.flag
            return { ...state, allImgFlag };
        case "GETSWDATA":
            let getSwData = state.getSwData
            getSwData = action.data.List
            return { ...state, getSwData };
        case "SWFLAG":
            let swFlag = state.swFlag
            swFlag = action.flag
            return { ...state, swFlag };
        default: return state;
    }
}